'\" te
.\" Copyright (c) 2004, Sun Microsystems, Inc.,
.\" All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH USB_CLR_FEATURE 9F "Feb 9, 2004"
.SH NAME
usb_clr_feature \- Clear feature of USB device, interface or endpoint
.SH SYNOPSIS
.nf
#include <sys/usb/usba.h>



\fBint\fR \fBusb_clr_feature\fR(\fBdev_info_t *\fR\fIdip\fR,
     \fBuint_t\fR \fIrequest_type\fR, \fBuint_t\fR \fIfeature\fR,
     \fBuint_t\fR \fIwhich\fR, \fBusb_flags_t\fR \fIflags\fR,
     \fBvoid (\fR\fI*callback)\fR (usb_pipe_handle_t \fIpipe_handle\fR,
     \fBusb_opaque_t\fR \fIcallback_arg\fR, \fBint\fR \fIrval\fR, \fBusb_cb_flags_t\fR \fIflags)\fR,
     \fBusb_opaque_t\fR \fIcallback_arg\fR);
.fi

.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI)
.SH PARAMETERS
.ne 2
.na
\fB\fIdip\fR\fR
.ad
.RS 16n
Pointer to the device's dev_info structure.
.RE

.sp
.ne 2
.na
\fB\fIpipe_handle\fR\fR
.ad
.RS 16n
Pipe handle to device, device interface or endpoint.
.RE

.sp
.ne 2
.na
\fB\fIrequest_type\fR\fR
.ad
.RS 16n
bmRequestType to be used.  One of the following:
.sp
USB_DEV_REQ_RCPT_DEV - Clear feature on device.
.sp
USB_DEV_REQ_RCPT_IF - Clear feature on interface.
.sp
USB_DEV_REQ_RCPT_EP - Clear feature on endpoint.
.RE

.sp
.ne 2
.na
\fB\fIfeature\fR\fR
.ad
.RS 16n
Feature to be cleared. Can be any device-defined device-, interface-, or
endpoint-specific feature, including the following which are defined in the
\fIUSB 2.0\fR specification:
.sp
USB_EP_HALT - Clear a HALT on an endpoint.
.sp
USB_DEV_REMOTE_WAKEUP - Clear REMOTE_WAKEUP on a device.
.sp
USB_DEV_TEST_MODE - Clear TEST_MODE on a device.
.RE

.sp
.ne 2
.na
\fBwhich\fR
.ad
.RS 9n
Device, interface or endpoint on which to  clear the feature. One of:
.br
.in +2
Interface number, for interfaces.
.in -2
.br
.in +2
Endpoint number, for endpoints.
.in -2
.br
.in +2
0 for devices.
.in -2
.RE

.sp
.ne 2
.na
\fBflags\fR
.ad
.RS 16n
USB_FLAGS_SLEEP is the only flag recognized. Wait for completion and do not
call callback.
.RE

.sp
.ne 2
.na
\fBcallback\fR
.ad
.RS 16n
Callback handler to notify of asynchronous completion.
.RE

.sp
.ne 2
.na
\fBcallback_arg\fR
.ad
.RS 16n
Second argument passed to callback handler.
.RE

.SH DESCRIPTION
The \fBusb_clr_feature()\fR function clears a specific feature of a device,
interface or endpoint. This function always blocks and waits for resources if
not available, regardless of the flags argument.
.sp
.LP
This call blocks for completion if USB_FLAGS_SLEEP is set in flags. It returns
immediately and calls the callback upon completion if USB_FLAGS_SLEEP is not
set.
.SH RETURN VALUES
.ne 2
.na
\fBUSB_SUCCESS\fR
.ad
.RS 23n
Feature was successfully cleared.
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_ARGS\fR
.ad
.RS 23n
\fIdip\fR argument is NULL.
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_PIPE\fR
.ad
.RS 23n
\fIpipe_handle\fR argument is NULL
.RE

.sp
.ne 2
.na
\fBUSB_INVALID_CONTEXT\fR
.ad
.RS 23n
Called from interrupt context with USB_FLAGS_SLEEP flag set.
.RE

.sp
.ne 2
.na
\fBUSB_FAILURE\fR
.ad
.RS 23n
Clearing of feature was unsuccessful.
.RE

.SH CONTEXT
May always be called from user or kernel context. May be called from interrupt
context only if USB_FLAGS_SLEEP is not set in flags.
.sp
.LP
If the USB_CB_ASYNC_REQ_FAILED bit is clear in usb_cb_flags_t, the callback, if
supplied, can block because it is executing in  kernel context. Otherwise the
callback cannot block. Please see \fBusb_callback_flags\fR(9S) for more
information on callbacks.
.SH EXAMPLES
.in +2
.nf
if (usb_clr_feature(dip, pipe_handle, USB_DEV_REQ_RCPT_EP,
       USB_EP_HALT, data_endpoint_num, 0) == USB_FAILURE) {
           cmn_err (CE_WARN,
               "%s%d: Error clearing halt condition on data endpoint %d.",
               ddi_driver_name(dip), ddi_get_instance(dip),
               data_endpoint_num);
   }

.fi
.in -2

.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Architecture	PCI-based systems
_
Interface stability	Committed
.TE

.SH SEE ALSO
.BR attributes (7),
.BR usb_get_status (9F),
.BR usb_pipe_get_state (9F),
.BR usb_pipe_reset (9F),
.BR usb_callback_flags (9S)
